<?php


	
	$ini_array = parse_ini_file("config/config.ini");
	
	
	
	$destination_folder = "picture/portrait/";
	date_default_timezone_set($ini_array["default_timezone"]);
	$datetime = date("YmdHis");
	if( isset($_POST["oldFile"]) ){
		if( file_exists($_POST["oldFile"] )){
			unlink($_POST["oldFile"]);
		}
	}
	$funcName = $_POST["funcName"];
	$file = $_FILES["portrait"];
	if( strcmp(filesize($file["tmp_name"]), "") != 0 ){
		$suffix = substr($file["name"], strrpos($file["name"], '.'));
		move_uploaded_file($file["tmp_name"], $destination_folder.$datetime.$suffix);
		echo "<script>parent.".$funcName."('".$destination_folder.$datetime.$suffix."')</script>";
	}else{
		echo "<script>parent.".$funcName."('')</script>";
	}
	


?>
